package org.yang.novel;

import com.geccocrawler.gecco.GeccoEngine;
import com.geccocrawler.gecco.annotation.Gecco;
import com.geccocrawler.gecco.annotation.HtmlField;
import com.geccocrawler.gecco.annotation.RequestParameter;
import com.geccocrawler.gecco.annotation.Text;
import com.geccocrawler.gecco.spider.HtmlBean;
@Gecco(pipelines="consolePipeline")
public class NovelTest implements HtmlBean {

    @Text
    @HtmlField(cssPath=".bookname")
    private String title;

    @Text
    @HtmlField(cssPath="#content")
    private String content;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }


    public static void main(String[] args) {
        GeccoEngine.create()
                //工程的包路径
                .classpath("org.yang.novel.NovelTest")
                //开始抓取的页面地址
                .start("http://www.xbiquge.la/13/13959/5939025.html")
                //开启几个爬虫线程
                .thread(1)
                //单个爬虫每次抓取完一个请求后的间隔时间
                .interval(2000)
                //循环抓取
                .loop(false)
                //使用pc端userAgent
                .mobile(false)
                //非阻塞方式运行
                .start();
    }
}
